package uns.fit.gis.mapobj;

import java.util.*;

public class Region {
	private int id;
	private byte type;
	//private Point[] drawingPoints;
	private int[] points;
	//private int level;
	//private Rectangle mbr;
	private int minXY;
	private int maxXY;
	//private String name;
	private byte[] name;
	
	public Region()
	{
		//mbr = new Rectangle();
		//name = "";
		setMinX(Integer.MAX_VALUE);
		setMinY(Integer.MAX_VALUE);
		setMaxX(Integer.MIN_VALUE);
		setMaxY(Integer.MIN_VALUE);
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public byte getType() {
		return type;
	}

	public void setType(byte type) {
		this.type = type;
	}
	/*
	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}
	*/
	/*
	public Rectangle getMbr() {
		return mbr;
	}

	public void setMbr(Rectangle mbr) {
		this.mbr = mbr;
	}
	*/
	/*
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	*/
	/*
	public Point[] getDrawingPoints() {
		return drawingPoints;
	}

	public void setDrawingPoints(Point[] drawingPoints) {
		this.drawingPoints = drawingPoints;
	}
	*/
	
	public void setX(int index, int x) {
        points[index] = ((x & 0xFFFF) << 16) | (points[index] & 0xFFFF);
    }

    public int getX(int index) {
        return ((points[index] >> 16) & 0xFFFF);
    }

    public void setY(int index, int y) {
        points[index] = (points[index] & 0xFFFF0000) | (y & 0xFFFF);
    }

    public int getY(int index) {
        return (points[index] & 0xFFFF);
    }
	
	public int getMinX() {
		return ((minXY >> 16) & 0xFFFF);
	}

	public void setMinX(int minX) {
		this.minXY = ((minX & 0xFFFF) << 16) | (this.minXY & 0xFFFF);
	}

	public int getMinY() {
		return (minXY & 0xFFFF);
	}

	public void setMinY(int minY) {
		this.minXY = (this.minXY & 0xFFFF0000) | (minY & 0xFFFF);
	}

	public int getMaxX() {
		return ((maxXY >> 16) & 0xFFFF);
	}

	public void setMaxX(int maxX) {
		this.maxXY = ((maxX & 0xFFFF) << 16) | (this.maxXY & 0xFFFF);
	}

	public int getMaxY() {
		return (maxXY & 0xFFFF);
	}

	public void setMaxY(int maxY) {
		this.maxXY = (this.maxXY & 0xFFFF0000) | (maxY & 0xFFFF);
	}

	public byte[] getName() {
		return name;
	}

	public void setName(byte[] name) {
		this.name = name;
	}
	
	public void setNumberOfPoints(int size) {
        points = new int[size];
    }

    public int getNumberOfPoints() {
        return points.length;
    }
}
